package com.idanchuang.component.sentinel.init;

/**
 * @author chac
 */
public final class ApolloConfigUtil {

    public static final String AUTHORITY_DATA_ID_POSTFIX = "-authority-rules";
    public static final String FLOW_DATA_ID_POSTFIX = "-flow-rules";
    public static final String PARAM_FLOW_DATA_ID_POSTFIX = "-param-flow-rules";
    public static final String API_DATA_ID_POSTFIX = "-apis";
    public static final String SYSTEM_DATA_ID_POSTFIX = "-system-rules";
    public static final String DEGRADE_DATA_ID_POSTFIX = "-degrade-rules";
    public static final String GLOBAL_AUTHORITY_DATA_ID_POSTFIX = "-global-authority-rules";
    public static final String GLOBAL_FLOW_DATA_ID_POSTFIX = "-global-flow-rules";
    public static final String GLOBAL_PARAM_FLOW_DATA_ID_POSTFIX = "-global-param-flow-rules";
    public static final String GLOBAL_API_DATA_ID_POSTFIX = "-global-apis";
    public static final String GLOBAL_SYSTEM_DATA_ID_POSTFIX = "-global-system-rules";
    public static final String GLOBAL_DEGRADE_DATA_ID_POSTFIX = "-global-degrade-rules";
    public static final String CLUSTER_CONFIG_DATA_ID_POSTFIX = "-cluster-config";

    private ApolloConfigUtil() {
    }

    public static String getFlowDataId(String appName) {
        return String.format("%s%s", appName, FLOW_DATA_ID_POSTFIX);
    }

    public static String getAuthorityDataId(String appName) {
        return String.format("%s%s", appName, AUTHORITY_DATA_ID_POSTFIX);
    }

    public static String getParamFlowDataId(String appName) {
        return String.format("%s%s", appName, PARAM_FLOW_DATA_ID_POSTFIX);
    }

    public static String getApiDataId(String appName) {
        return String.format("%s%s", appName, API_DATA_ID_POSTFIX);
    }

    public static String getSystemDataId(String appName) {
        return String.format("%s%s", appName, SYSTEM_DATA_ID_POSTFIX);
    }

    public static String getDegradeDataId(String appName) {
        return String.format("%s%s", appName, DEGRADE_DATA_ID_POSTFIX);
    }

    public static String getGlobalAuthorityDataId(String appName) {
        return String.format("%s%s", appName, GLOBAL_AUTHORITY_DATA_ID_POSTFIX);
    }

    public static String getGlobalFlowDataId(String appName) {
        return String.format("%s%s", appName, GLOBAL_FLOW_DATA_ID_POSTFIX);
    }

    public static String getGlobalParamFlowDataId(String appName) {
        return String.format("%s%s", appName, GLOBAL_PARAM_FLOW_DATA_ID_POSTFIX);
    }

    public static String getGlobalApiDataId(String appName) {
        return String.format("%s%s", appName, GLOBAL_API_DATA_ID_POSTFIX);
    }

    public static String getGlobalSystemDataId(String appName) {
        return String.format("%s%s", appName, GLOBAL_SYSTEM_DATA_ID_POSTFIX);
    }

    public static String getGlobalDegradeDataId(String appName) {
        return String.format("%s%s", appName, GLOBAL_DEGRADE_DATA_ID_POSTFIX);
    }

    public static String getClusterConfigDataId(String appName) {
        return String.format("%s%s", appName, CLUSTER_CONFIG_DATA_ID_POSTFIX);
    }
}
